using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
class Program
{
    static void Main()
    {
        //List<long> array = new List<long>();
        //int n = int.Parse(Console.ReadLine());
        //for (int i = 0; i < n; i++)
        //{
        //    array.Add(long.Parse(Console.ReadLine()));
        //}
        //List<long> array = new List<long> { -1, 7, 7, -9223372036854775808, 7, -9223372036854775808, -3, 7, 0, -1, 7, 99, -3 };
        //List<long> array = new List<long> { 1, 2, 1 };
        //List<long> array = new List<long> { -1, 7, 7, -9223372036854775808, 7, -9223372036854775808, -3, 7, 0, -1, 7, 0, -3,800 };
        //array.Sort();
        int n = int.Parse(Console.ReadLine());
 
        long[] array = new long[n];
 
        for (int i = 0; i < n; i++)
        {
            array[i] = (long.Parse(Console.ReadLine()));
        }
 
        Array.Sort(array);
 
        int counter = 1;
 
        long result = 0;
 
        for (int i = array.Length - 1; i >= 0; i--)
        {
            if (array.Length == 1)
            {
                Console.WriteLine(array[i]);
 
                return;
            }
            if (array[0] != array[1])
            {
                Console.WriteLine(array[0]);
 
                return;
            }
 
            if (i!=0)
            {
                if (array[i] == array[i - 1])
                {
                    counter++;
                }
                else
                {
                    if (counter % 2 != 0)
                    {
                        result = array[i];
 
                        Console.WriteLine(result);
 
                        return;
                    }
 
                    counter = 1;
                }
            }
 
            else
            {
                if (counter % 2 != 0)
                {
                    result = array[i];
 
                    Console.WriteLine(result);
 
                    return;
                }
 
                counter = 1;
            }
 
 
        }
    }
}